<template>
	<view>
		<!--#ifdef APP-PLUS-->
		<view class="lz-status_bar">
			<view class="lz-top_view"></view>
		</view>
		<!--#endif-->
		<!-- #ifndef MP-WEIXIN -->
		<view class="kaoshi-head">
			<view class="kaoshi-head-top">
				<view class="kaoshi-head-left" @tap="$navigateBack">
					<view class="iconfont icon-zuojiantou"></view>
				</view>
				<view class="kaoshi-head-m">{{title}}</view>
				<view class="kaoshi-head-right"></view>
			</view>
		</view>
		<!--#endif-->
		<view class="index-tiku notice-detail" v-if="info.title != undefined">
			<view class="notice-detail-title">{{info.title}}</view>
			<view class="notice-detail-time">
				<view class="pub-gray">发布时间:{{info.noticetime}}</view>
			</view>
			<view class="notice-detail-content">
				<uParse :content="info.content" />
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import uParse from '@/components/uParse/gaoyia-parse/parse.vue';
	export default {
		data() {
			return {
				info: {},
				id: 0,
				title: '',
			}
		},
		components: {
			uParse
		},
		computed: {
			...mapState(['subject', 'userinfo']),
		},
		onShow() {
			this.getJiaocheng()
		},
		onLoad(opts) {
			if (opts && opts.id) {
				this.id = opts.id
				console.log(opts.type);
				if (opts.type == 1) {
					this.title = '资讯详情'
					uni.setNavigationBarTitle({
					    title: "资讯详情"
					});
				} else if (opts.type == 2) {
					this.title = '通知详情'
					uni.setNavigationBarTitle({
					    title: "通知详情"
					});
				}
			}
			// #ifdef MP-WEIXIN
			wx.showShareMenu({
				withShareTicket: true,
				menus: ["shareAppMessage", "shareTimeline"]
			})
			// #endif
		},
		methods: {
			async getJiaocheng() {
				let res = await this.$myHttp.post({
					url: this.$myHttp.urlMap.articleInfo,
					data: {
						id: this.id,
						subject_id: this.subject.id,
					},
					needLogin: false,
				})
				if (res.code == 1) {
					this.info = res.data
				}
			},
		}
	}
</script>

<style>
	page {
		background: #fff;
	}

	/*消息详情*/
	.notice-detail {
		width: 92%;
		margin: 12px auto;
		font-size: 16px;
	}

	.notice-detail-content image {
		width: 100% !important;
	}

	.notice-detail-title {
		font-size: 18px;
		font-weight: bold;
	}

	.notice-detail-time {
		display: flex;
		font-size: 14px;
		align-items: center;
		margin: 10px 0 9px;
	}

	.notice-detail-blue {
		color: #000;
		font-weight: bold;
		margin-right: 10px;
		font-size: 15px;
	}

	.notice-detail-content {
		line-height: 23px;
	}
</style>
